package com.my.dao;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;
import com.my.core.annotation.shiro.TableMapping;
import com.my.core.constant.MyCommonContant;

@TableMapping(tableName="user")
public class User extends Model<User> {
	public static final User dao = new User().dao();
	public static final int HASH_INTERATIONS = 1024;
	public User getUser(String usercode, String password) {
		return User.dao.findFirst("select * from user where usercode=? and password=?", new Object[]{usercode,password});
	}

	public User getUserByCode(String usercode) {
		return User.dao.findFirst("select * from user where usercode=? and status = ?", new Object[]{usercode,MyCommonContant.DATA_COMMON});
	}
	
	public boolean isAdmin(User user){
		return true;
	}

	public List<String> getUserRoles(String usercode) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<String> getUserPermissions(String usercode){
		return null;
	}
}
